package com.czk.ssaprompttemplate.config;

import org.springframework.ai.chat.client.ChatClient;
import org.springframework.ai.chat.model.ChatModel;
import org.springframework.ai.chat.prompt.ChatOptions;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Author: chenzhangkun
 * @CreateTime: 2025-10-14
 * @Description:
 * @Version: 1.0
 */
@Configuration
public class ChatClientConfig {
    /**
     * deepseek模型
     */
    private final String DEEPSEEK_MODEL = "deepseek-v3";
    /**
     * 千问模型
     */
    private final String QWEN_MODEL = "qwen-max";

    /**
     * 实例化chatClient对象
     * 依附于chatModel对象
     * 这里deepseek的chatModel对象
     *
     * @param dashScopeChatModel
     * @return
     */
    @Bean(name = "deepseekChatClient")
    public ChatClient deepseekChatClient(@Qualifier(value = "deepseek") ChatModel dashScopeChatModel) {
        return ChatClient
                // 这里又指定了一次模型，可以不指定，下面千问模型不再指定模型也可以
                .builder(dashScopeChatModel).defaultOptions(ChatOptions.builder().model(DEEPSEEK_MODEL).build())
                .build();
    }

    /**
     * 实例化chatClient对象
     * 这里依附于千问的chatModel
     *
     * @param dashScopeChatModel
     * @return
     */
    @Bean(name = "qwenChatClient")
    public ChatClient qwenChatClient(@Qualifier(value = "qwen") ChatModel dashScopeChatModel) {
        return ChatClient.builder(dashScopeChatModel).build();
    }

}
